var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (im.getServerName().equals("BMS单机") && im.getServerName().equals("BMS至尊体验服") && !im.getServerName().equals("BMS至尊")) {
        im.playerMessage(1, " 使用环境异常，请还原服务端配置。");
        im.dispose();
        return
    }
    if (status == 0 && d == 0) {
        im.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        im.dispose()
    } else {
        if (status === a++) {
            im.dispose();
            var e = im.getItemId();
            im.gainItem(e, -1);
            im.gainItem(weapons[im.rand(0, weapons.length - 1)], 1)
        }
    }
}
var weapons = [1322256, 1492231, 1472261, 1242116, 1552128, 1242123, 1492236, 1242120, 1252104, 1472266, 1322250, 1242124, 1332274, 1372222, 1332280, 1302333, 1690203, 1412182, 1412177, 1372229, 1302344, 1382259, 1382266, 1422190, 1422184, 1342101, 1402260, 1432214, 1342105, 1432219, 1402251, 1212115, 1362135, 1272016, 1592028, 1272021, 1462239, 1362141, 1442268, 1452252, 1592019, 1212121, 1262040, 1542108, 1522138, 1222109, 1262017, 1312199, 1582027, 1312204, 1582017, 1232114, 1292017, 1532148, 1532144, 1252093, 1292028, 1222114, 1442276, 1462244, 1282016, 1452258, 1282022, 1522144, 1482222, 1542126, 1552110, 1482216, 1232109];